{% extends 'base.html' %}

{% load crispy_forms_tags %}

{% block content %}
    <form method="POST">
        {% csrf_token %}
        {{ formsets.management_form }}
        {% for form in formsets %}
            {% if forloop.counter0|divisibleby:2 %}
                <div class="form-row">
            {% endif %}
        <div class="form-group col-md-2">
            {{ form.duty_date|as_crispy_field }}
        </div>
        <div class="form-group col-md-2">
            {{ form.arrange_duty_person|as_crispy_field }}
        </div>
            <div class="col-md-1"></div>
        {% if forloop.counter0|add:1|divisibleby:2 or forloop.last %}
            </div>
        {% endif %}
        {% endfor %}
        <div class="row">
            <div class="col-md-2 mb-4">
                <button type="submit" class="btn btn-primary">保存</button>
            </div>
        </div>
    </form>
{% endblock %}
